package util;

import java.awt.Component;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class DateRenderer extends DefaultTableCellRenderer{
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private SimpleDateFormat date = null;
	
	public DateRenderer() {
		date = new SimpleDateFormat("dd.MM.yyyy");
	}

	@Override
    public Component getTableCellRendererComponent( JTable table, Object value, 
            boolean isSelected, boolean hasFocus, int row, int column ) {
        Date d = (Date) value;
        String text = date.format(d);
        return super.getTableCellRendererComponent( table, text, isSelected,
            hasFocus,  row, column );
    }
}